#!/bin/bash

source /etc/profile

if [ $# -eq 1 ]; then
	targetHour=$1
else
	targetHour=`date -d "-1 hours" +"%Y%m%d%H"`
fi
path=$(cd $(dirname $0);pwd)
parentPath=$(dirname ${path})
targetDate=${targetHour:0:8}
day=$(date -d"${targetDate}" "+%Y-%m-%d")
source ${parentPath}/configs/mysql_config
today=$(date -d"${targetDate} +1 days" "+%Y-%m-%d")
python ${path}/analysis_quota_forecast.py ${host} ${port} ${user} ${password} ${db} ${day} ${today}